# .编写Python程序，要求利用函数实现求阶乘1!+2!+...+n!的和，
# 并利用该函数求1!+2!+3!+4!+5!+6!的和
def factorial(x):
    start = 1
    for j in range(1,x+1):
        start*= j
    return start
def factSum(n):
    sumf = 0
    for i in range(1,n+1):
        sumf+=factorial(i)
    return sumf

print(factSum(6))